package cn.hfjava.crm;
//定义员工类
public class Employee {
    public String name;
    //基本工资
    public double salary;
    //加班补贴
    public double subsidy;

    //计算所得税的方法

    public double calaIncomeTax() {
        //基本工资
        double baseSalary = 5000;
        // 税前收入 =工资+加班补贴
        double totalMoney = this.salary + this.subsidy;

        double amount = 0.0;
        if (totalMoney <= 3500) {
            amount = 0.0;
        } else {
            double extra = totalMoney - 3500;
            if (extra >= 0 && extra <= 500) {
                amount = extra * 0.05;
            } else if (extra > 500 && extra <= 2000) {
                amount = extra * 0.1;
            } else if (extra > 2000 && extra <= 5000) {
                amount = extra * 0.15;
            } else if (extra > 5000 && extra <= 20000) {
                amount = extra * 0.2;
            } else if (extra > 20000) {
                amount = extra * 0.3;
            }

        }
        double actualMoney = totalMoney - amount;
        return actualMoney;
    }
}